
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>

#include <ProbabilityImpl.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Probability,"Test Probability")
{
	TEST("should be able to get the probability of A and B:0.2*0.2 =0.04")
	{
		Probability* pProbability = dynamic_cast<Probability*> (new ProbabilityImpl(0.2,0.2));
		ASSERT_DELTA(0.04, pProbability->getAAndB(),0.000001);
		delete pProbability;
	}

	TEST("should be able to get the probability of A or B:0.2+0.2-0.2*0.2 = 0.36")
	{
		Probability* pProbability = dynamic_cast<Probability*> (new ProbabilityImpl(0.2,0.2));
		ASSERT_DELTA(0.36, pProbability->getAOrB(),0.000001);
		delete pProbability;
	}

	TEST("should be able to get the probability A didn't occur:1-0.2 = 0.8")
	{
		Probability* pProbability = dynamic_cast<Probability*> (new ProbabilityImpl(0.2,0.2));
		ASSERT_DELTA(0.8, pProbability->getNotA(),0.000001);
		delete pProbability;
	}
};

